#ifndef NETSTAT_H
#define NETSTAT_H

#include <QObject>
#include <QStringList>
#include <QRegExp>
#include <QFile>
#include <QTextStream>
#include <QMap>
#include <QVariant>
#include <QDir>

#include <QDebug>

//#include <QHostAddress>

class NetStat : public QObject
{
    Q_OBJECT
    QString file_tcp;
    QString file_udp;
    QStringList tcp_state;

    bool keyWork;

    QRegExp qre;

    QString convert_ipaddr( const QString &str_ip_addr ) const;
    int getPidByInode( const int inode );
    QString getInfoProcByPid( const int pid );

public:
    explicit NetStat(QObject *parent = 0);
    void tryStopNetStat();
    void workNetStat();
    QList<QMap<QString, QVariant>*> getStatTCP( const bool resolve = false );
    QList<QMap<QString, QVariant>*> getStatUDP( const bool resolve = false );
    
signals:
    
public slots:
    
};

#endif // NETSTAT_H
